<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>天天生鲜-支付管理</title>
<base href="../">
<link rel="shortcut icon" href="images/copylogo.png">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/pay.css">
<link rel="stylesheet" href="css/foot.css">
</head>

<body>
<div id="app">
<!-- 头部  -->
	<div class="header_con">
    	<div class="header">
    		<div class="welcome fl">欢迎来到天天生鲜</div>
    		<div class="fr">
                <div class="login_btn fl">
                	欢迎：<b>源辰</b><span> |
                </div>
                <div class="login_btn fl">
                	<a href="login.html">登录</a><span> | </span><a href="register.html">注册</a>
                </div>
            	 <div class="user_link fl">
                    <span> | </span>
                    <a href="user.html">用户中心</a>
                    <span> | </span>
                    <a href="front/cart.html" target="_blank">我的购物车</a>
                    <span> | </span>
                    <a href="front/order.html" target="_blank">我的订单</a>
           		 </div> 
             </div>  
    	</div>
    </div>
    
     <!-- 搜素框 -->
     <div class="search_bar clearfix">
 		<a href="index.html" class="logo fl"><img src="images/logo.png"></a>
 		<div class="search_con fl">
        	<form>
                <input type="text" class="input_text fl" name="key_words" placeholder="搜索商品"/>
                <input type="submit" class="input_btn fr"  value="搜索"/>
            </form>
        </div>
 		<div class="guest_cart fr">
        	<a href="front/cart.html" class="cart_name fl" target="_blank">我的购物车</a>
            <div class="goods_count fl" id="show_count">5</div>
        </div>
     </div>
    
     <!-- 收货地址 -->
    <h3 class="common_title">确认收货地址</h3>

	<div class="common_list_con clearfix">
		<input type="hidden" id="receive_addr" />
		<dl id="addr_list">
			<dt>寄送到：</dt>
			<!-- :class="{addr.status == 1 ? '': ''}" 
				:class="{selectedAddr:addr.flag == 1}"
			-->
			<dd>
				<span>邮寄到 </span>湖南省&nbsp;衡阳市&nbsp;珠晖区&nbsp;衡州大道48号&nbsp;（源辰&nbsp;收）&nbsp; 07348355998
			</dd>
			<dd>
				<span>邮寄到 </span>湖南省&nbsp;衡阳市&nbsp;珠晖区&nbsp;衡州大道48号&nbsp;（源辰&nbsp;收）&nbsp; 07348355998
			</dd>
		</dl>
		<a href="javascript:showAddrDiv()" class="edit_site">编辑收货地址</a>
	</div>
	
	<div id="addr_div">
		<img src="images/close.png" title="关闭" onclick="hiddenDiv()" />
		<form id="myform">
			<ul>
				<li>
					<label for="addr_name">收货人：</label>
					<input id="addr_name" name="name" type="text" placeholder="请输入收货人姓名" />
				</li>
				<li>
					<label for="addr_tel">联系方式：</label>
					<input id="addr_tel" name="tel" type="tel" placeholder="请输入收货人联系方式" />
				</li>
				<li>
					<label for="addr_name">收货地址：</label>
					<select id="province" name="province"></select>
					<select id="city" name="city">
						<option value="0">--请选择城市--</option>
					</select>
					<select id="area" name="area">
						<option value="0">--请选择地区--</option>
					</select>
				</li>
				<li>
					<label for="addr_addr">详细地址：</label>
					<input id="addr_addr" name="addr" style="width: 480px;" type="text" placeholder="请输入详细地址（街道、门牌等）" />
				</li>
				<li class="addr_btn">
					<a href="javascript:addAddr()">添加收货地址</a>
				</li>
			</ul>
		</form>
	</div>
    
   	<!-- 支付方式 -->	
    <h3 class="common_title">支付方式</h3>	
	<div class="common_list_con clearfix">
		<div class="pay_style_con clearfix">
			<input type="radio" name="pay_style">
			<label class="cash">货到付款</label>
			<input type="radio" name="pay_style">
			<label class="weixin">微信支付</label>
			<input type="radio" name="pay_style" checked>
			<label class="zhifubao"></label>
			<input type="radio" name="pay_style">
			<label class="bank">银行卡支付</label>
		</div>
	</div>
    
   	<!-- 商品列表 -->
    <h3 class="common_title">商品列表</h3>
	<div class="common_list_con clearfix" id="order_list">
		<ul class="goods_list_th clearfix">
			<li class="col01">商品名称</li>
			<li class="col02">商品净重/单位</li>
			<li class="col03">商品价格</li>
			<li class="col04">数量</li>
			<li class="col05">小计</li>		
		</ul>
		<ul class="goods_list_td clearfix">
			<li class="col01">1</li>			
			<li class="col02"><img src="images/goods/goods012.jpg"></li>
			<li class="col03">草莓</li>
			<li class="col04">500G / 盒</li>
			<li class="col05">48.50元</li>
			<li class="col06">1</li>
			<li class="col07">48.50 元</li>	
		</ul>
		<ul class="goods_list_td clearfix">
			<li class="col01">2</li>			
			<li class="col02"><img src="images/goods/goods011.jpg"></li>
			<li class="col03">草莓</li>
			<li class="col04">500G / 盒</li>
			<li class="col05">48.50元</li>
			<li class="col06">1</li>
			<li class="col07">48.50 元</li>	
		</ul>
		<ul class="goods_list_td clearfix">
			<li class="col01">3</li>			
			<li class="col02"><img src="images/goods/goods010.jpg"></li>
			<li class="col03">草莓</li>
			<li class="col04">500G / 盒</li>
			<li class="col05">48.50元</li>
			<li class="col06">1</li>
			<li class="col07">48.50 元</li>	
		</ul>
		<ul class="goods_list_td clearfix">
			<li class="col01">4</li>			
			<li class="col02"><img src="images/goods/goods009.jpg"></li>
			<li class="col03">草莓</li>
			<li class="col04">500G / 盒</li>
			<li class="col05">48.50元</li>
			<li class="col06">1</li>
			<li class="col07">48.50 元</li>	
		</ul>
	</div>
     
    <!-- 金额结算 -->	
    <h3 class="common_title">总金额结算</h3>
	<div class="common_list_con clearfix">
		<div class="settle_con">
			<div class="total_goods_count">共<em id="total_count">3</em>件商品，总金额<b id="total_price">168.20元</b></div>
			<div class="transit">运费：<b>10元</b></div>
			<div class="total_pay">实付款：<b id="real_price">178.20元</b></div>
		</div>
	</div>
	<div class="order_submit clearfix">
		<a href="javascript:void(0);" id="order_btn" onclick="payOrder()">提交订单</a>
	</div>	
    
    <div class="popup_con">
		<div class="popup">
			<p>订单提交成功！</p>
		</div>
		
		<div class="mask"></div>
	</div>    
</div>       
<!-- 版权所有 -->
<div class="footer">
	<div class="foot_link">
		<a href="#">关于我们</a> <span> | </span>
        <a href="#">联系我么</a> <span> | </span>
        <a href="#">招聘人才</a> <span> | </span>
        <a href="#">友情链接</a> 
	</div>
	<p>CcpyRight &copy; 2019 衡阳市源辰信息科技有限公司 All Rights Reserverd</p>
    <p>电话：0734-8355998 湘ICP备16015987号</p>
</div>
    
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="js/addr.js"></script>
<script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/axios.js"></script>
<script type="text/javascript" src="js/qs.js"></script>
<script type="text/javascript" src="js/show-dialog.js"></script>
<script type="text/javascript">
$(function(){
	$("#addr_addr").keyup(function(event) {
		if (event.which == 13) {
			addAddr();
		}
	})
	
	$("#addr_list>dd").click(function(){
		$("#addr_list>dd").removeClass("selectedAddr");
		$(this).addClass("selectedAddr");
	});
})

function showAddrDiv() {
	$("#myform")[0].reset();
	$("#addr_div").css("display", "block");
}

function hiddenDiv(){
	$("#addr_div").css("display", "none");
}

function addAddr() {
	let objs = $("#myform input, #myform select");
	for (let i = 0, len = objs.length; i < len; ++i) {
		if ($.trim(objs[i].value) == "" || objs[i].value == "--请选择省份--") {
			showmsg("您输入的信息不完整，请完善后重新提交...", "red");
			return;
		}
	}
	
	$.post("addr/add", $("#myform").serialize(), rt => {
		if (rt.code == 200) {
			let obj = {ano: rt.data};
			obj.name = $.trim($("#addr_name").val());
			obj.tel = $.trim($("#addr_tel").val());
			obj.province = $.trim($("#province").val());
			obj.city = $.trim($("#city").val());
			obj.area = $.trim($("#area").val());
			obj.addr = $.trim($("#addr_addr").val());
			obj.flag = 0;
			app.$data.addrs.push(obj);
			$("#myform")[0].reset();
			hiddenDiv();
			bindInfo();
			return;
		}
		showmsg("收获地址添加失败，请稍后重试...", "red");
	}, "json");
}

function bindInfo() {
	$("#addr_list>dd").click(function(){
		$("#addr_list>dd").removeClass("selectedAddr");
		$(this).addClass("selectedAddr");
	});
}
</script>
</body>
</html>